home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Visual Basic Toolbox
/
Visual Basic Toolbox (P.I.E.)(1996).ISO
/
dialog
/
dialogs
/
dialogs.bas
next >
Wrap
BASIC Source File
|
1992-07-03
|
9KB
|
278 lines
Rem Demo for accessing Win 3.1 Common Dialogs
Rem Author: Costas Kitsos, CIS 73667,1755
Rem Revision: 1.00.00, July 4 1992
DefInt A-Z
' File Open/Save structures and declarations *****************************
Type OPENFILENAME
lStructSize As Long
hwndOwner As Integer
hInstance As Integer
lpstrFilter As Long
lpstrCustomFilter As Long
nMaxCustFilter As Long
nFilterIndex As Long
lpstrFile As Long
nMaxFile As Long
lpstrFileTitle As Long
nMaxFileTitle As Long
lpstrInitialDir As Long
lpstrTitle As Long
Flags As Long
nFileOffset As Integer
nFileExtension As Integer
lpstrDefExt As Long
lCustData As Long
lpfnHook As Long
lpTemplateName As Long
End Type
Declare Function GetOpenFileName Lib "COMMDLG.DLL" (pOPENFILENAME As OPENFILENAME) As Integer
Declare Function GetSaveFileName Lib "COMMDLG.DLL" (pOPENFILENAME As OPENFILENAME) As Integer
Declare Function GetFileTitle Lib "COMMDLG.DLL" (ByVal FName As String, ByVal Title As String, Size As Integer)
Global Const OFN_READONLY = &H1
Global Const OFN_OVERWRITEPROMPT = &H2
Global Const OFN_HIDEREADONLY = &H4
Global Const OFN_NOCHANGEDIR = &H8
Global Const OFN_SHOWHELP = &H10
Global Const OFN_ENABLEHOOK = &H20
Global Const OFN_ENABLETEMPLATE = &H40
Global Const OFN_ENABLETEMPLATEHANDLE = &H80
Global Const OFN_NOVALIDATE = &H100
Global Const OFN_ALLOWMULTISELECT = &H200
Global Const OFN_EXTENSIONDIFFERENT = &H400
Global Const OFN_PATHMUSTEXIST = &H800
Global Const OFN_FILEMUSTEXIST = &H1000
Global Const OFN_CREATEPROMPT = &H2000
Global Const OFN_SHAREAWARE = &H4000
Global Const OFN_NOREADONLYRETURN = &H8000
Global Const OFN_NOTESTFILECREATE = &H10000
Global Const OFN_SHAREFALLTHROUGH = 2
Global Const OFN_SHARENOWARN = 1
Global Const OFN_SHAREWARN = 0
'ChooseColor structure and function declarations *************************
Type ChooseColor
lStructSize As Long
hwndOwner As Integer
hInstance As Integer
RgbResult As Long
lpCustColors As Long
Flags As Long
lCustData As Long
lpfnHook As Long
lpTemplateName As Long
End Type
Declare Function ChooseColor Lib "COMMDLG.DLL" (pCHOOSECOLOR As ChooseColor) As Integer
Global Const CC_RGBINIT = &H1
Global Const CC_FULLOPEN = &H2
Global Const CC_PREVENTFULLOPEN = &H4
Global Const CC_SHOWHELP = &H8
Global Const CC_ENABLEHOOK = &H10
Global Const CC_ENABLETEMPLATE = &H20
Global Const CC_ENABLETEMPLATEHANDLE = &H40
'ChooseFont structure and function declarations *************************
Type ChooseFont
lStructSize As Long
hwndOwner As Integer
hDC As Integer
lpLogFont As Long
iPointSize As Integer
Flags As Long
rgbColors As Long
lCustData As Long
lpfnHook As Long 'Integer
lpTemplateName As Long
hInstance As Integer
lpszStyle As Long
nfonttype As Integer
nSizeMin As Integer
nSizeMax As Integer
End Type
Declare Function ChooseFont Lib "COMMDLG.DLL" (pCHOOSEFONT As ChooseFont) As Integer
Global Const CF_SCREENFONTS = &H1&
Global Const CF_PRINTERFONTS = &H2&
Global Const CF_BOTH = (CF_SCREENFONTS Or CF_PRINTERFONTS)
Global Const CF_SHOWHELP = &H4&
Global Const CF_ENABLEHOOK = &H8&
Global Const CF_ENABLETEMPLATE = &H10&
Global Const CF_ENABLETEMPLATEHANDLE = &H20&
Global Const CF_INITTOLOGFONTSTRUCT = &H40&
Global Const CF_USESTYLE = &H80&
Global Const CF_EFFECTS = &H100&
Global Const CF_APPLY = &H200&
Global Const CF_ANSIONLY = &H400&
Global Const CF_NOVECTORFONTS = &H800&
Global Const CF_NOOEMFONTS = CF_NOVECTORFONTS
Global Const CF_NOSIMULATIONS = &H1000&
Global Const CF_LIMITSIZE = &H2000&
Global Const CF_FIXEDPITCHONLY = &H4000&
Global Const CF_WYSIWYG = &H8000& 'must also have CF_SCREENFONTS and CF_PRINTERFONTS
Global Const CF_FORCEFONTEXIST = &H1000&
Global Const CF_SCALABLEONLY = &H2000&
Global Const CF_TTONLY = &H4000&
Global Const CF_NOFACESEL = &H8000&
Global Const CF_NOSTYLESEL = &H100000
Global Const CF_NOSIZESEL = &H200000
Global Const SIMULATED_FONTTYPE = &H8000
Global Const PRINTER_FONTTYPE = &H4000
Global Const SCREEN_FONTTYPE = &H2000
Global Const BOLD_FONTTYPE = &H100
Global Const ITALIC_FONTTYPE = &H200
Global Const REGULAR_FONTTYPE = &H400
Global Const WM_CHOOSEFONT_GETLOGFONT = (&H400 + 1) 'WM_USER + 1
Global Const LBSELCHSTRING = "commdlg_LBSelChangedNotify"
Global Const SHAREVISTRING = "commdlg_ShareViolation"
Global Const FILEOKSTRING = "commdlg_FileNameOK"
Global Const COLOROKSTRING = "commdlg_ColorOK"
Global Const SETRGBSTRING = "commdlg_SetRGBColor"
Global Const FINDMSGSTRING = "commdlg_FindReplace"
Global Const HELPMSGSTRING = "commdlg_help"
Global Const CD_LBSELNOITEMS = -1
Global Const CD_LBSELCHANGE = 0
Global Const CD_LBSELSUB = 1
Global Const CD_LBSELADD = 2
'Printer related structures and function declarations ********************
Type PrintDlg
lStructSize As Long
hwndOwner As Integer
hDevMode As Integer
hDevNames As Integer
hDC As Integer
Flags As Long
nFromPage As Integer
nToPage As Integer
nMinPage As Integer
nMaxPage As Integer
nCopies As Integer
hInstance As Integer
lCustData As Long
lpfnPrintHook As Long
lpfnSetupHook As Long
lpPrintTemplateName As Long
lpSetupTemplateName As Long
hPrintTemplate As Integer
hSetupTemplate As Integer
End Type
Declare Function PrintDlg Lib "COMMDLG.DLL" (pPrintDLG As PrintDlg) As Integer
Global Const PD_ALLPAGES = &H0
Global Const PD_SELECTION = &H1
Global Const PD_PAGENUMS = &H2
Global Const PD_NOSELECTION = &H4
Global Const PD_NOPAGENUMS = &H8
Global Const PD_COLLATE = &H10
Global Const PD_PRINTTOFILE = &H20
Global Const PD_PRINTSETUP = &H40
Global Const PD_NOWARNING = &H80
Global Const PD_RETURNDC = &H100
Global Const PD_RETURNIC = &H200
Global Const PD_RETURNDEFAULT = &H400
Global Const PD_SHOWHELP = &H800
Global Const PD_ENABLEPRINTHOOK = &H1000
Global Const PD_ENABLESETUPHOOK = &H2000
Global Const PD_ENABLEPRINTTEMPLATE = &H4000
Global Const PD_ENABLESETUPTEMPLATE = &H8000
Global Const PD_ENABLEPRINTTEMPLATEHANDLE = &H10000
Global Const PD_ENABLESETUPTEMPLATEHANDLE = &H20000
Global Const PD_USEDEVMODECOPIES = &H40000
Global Const PD_DISABLEPRINTTOFILE = &H80000
Global Const PD_HIDEPRINTTOFILE = &H100000
Type DEVNAMES
wDriverOffset As Integer
wDeviceOffset As Integer
wOutputOffset As Integer
wDefault As Integer
End Type
Global Const DN_DEFAULTPRN = &H1
'retrieves error value
Declare Function CommDlgExtendedError Lib "COMMDLG.DLL" () As Long
'************************* end of Common Dialogs Declares ************
' GLOBAL MEMORY Stuff
Declare Function GlobalAlloc Lib "Kernel" (ByVal wFlags As Integer, ByVal dwBytes As Long) As Integer
Declare Function GlobalFree Lib "Kernel" (ByVal hMem As Integer) As Integer
Declare Function GlobalLock Lib "Kernel" (ByVal hMem As Integer) As Long
Declare Function GlobalUnlock Lib "Kernel" (ByVal hMem As Integer) As Integer
Global Const GMEM_MOVEABLE = &H2
Global Const GMEM_ZEROINIT = &H40
Global Const GHND = (GMEM_MOVEABLE Or GMEM_ZEROINIT)
Declare Sub hmemcpy Lib "Kernel" (lpDest As Any, lpSource As Any, ByVal dwBytes As Long)
' FONT STUFF
Global Const LF_FACESIZE = 32
Type LogFont
lfHeight As Integer
lfWidth As Integer
lfEscapement As Integer
lfOrientation As Integer
lfWeight As Integer
lfItalic As String * 1
lfUnderline As String * 1
lfStrikeOut As String * 1
lfCharSet As String * 1
lfOutPrecision As String * 1
lfClipPrecision As String * 1
lfQuality As String * 1
lfPitchAndFamily As String * 1
lfFaceName As String * LF_FACESIZE
End Type
Global Const LOGPIXELSY = 90 ' Logical pixels/inch in Y
Declare Function GetDeviceCaps Lib "GDI" (ByVal hDC As Integer, ByVal nIndex As Integer) As Integer
'PRINTER stuff
Declare Function DeleteDC Lib "GDI" (ByVal hDC As Integer) As Integer
Type DevMode
dmDeviceName As String * 32
dmSpecVersion As Integer
dmDriverVersion As Integer
dmSize As Integer
dmDriverExtra As Integer
dmFields As Long
dmOrientation As Integer
dmPaperSize As Integer
dmPaperLength As Integer
dmPaperWidth As Integer
dmScale As Integer
dmCopies As Integer
dmDefaultSource As Integer
dmPrintQuality As Integer
dmColor As Integer
dmDuplex As Integer
dmYResolution As Integer
dmTTOption As Integer
End Type